package com.mo.design.pattern.creational.singleton;

/**
 *  单例模式
 */
public class Singleton {
    private static Singleton instance;
    private Singleton() {
        System.out.println("Singleton is Instantiated.");
    }

    public static Singleton getInstance() {
        if (instance == null) {
            instance = new Singleton();
        }
        return instance;
    }

    public void doSomething() {
        System.out.println("something is Done.");
    }

    public static void main(String[] args) {
        getInstance().doSomething();
    }
}
